from django.db import models


class TbCustomInfo(models.Model):
    c_name = models.CharField(max_length=255, blank=True, null=True)
    c_name_short = models.CharField(max_length=255, blank=True, null=True)
    c_num = models.CharField(max_length=255, blank=True, null=True)
    c_type = models.CharField(max_length=255, blank=True, null=True)
    c_site = models.CharField(max_length=255, blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    modify_time = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    delete_flag = models.IntegerField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_custom_info'


class TbCustomerPaper(models.Model):
    ecn_no = models.CharField(db_column='ECN_NO', max_length=255, blank=True, null=True)  # Field name made lowercase.
    version = models.CharField(max_length=255, blank=True, null=True)
    p_name = models.CharField(max_length=255, blank=True, null=True)
    st_site = models.CharField(db_column='ST_site', max_length=255, blank=True, null=True)  # Field name made lowercase.
    drawing_type = models.CharField(max_length=255, blank=True, null=True)
    definer_name = models.CharField(max_length=255, blank=True, null=True)
    c_name = models.CharField(max_length=255, blank=True, null=True)
    c_type = models.CharField(max_length=255, blank=True, null=True)
    c_site = models.CharField(max_length=255, blank=True, null=True)
    uploader = models.CharField(max_length=255, blank=True, null=True)
    custters_spec = models.CharField(max_length=255, blank=True, null=True)
    case_name = models.CharField(max_length=255, blank=True, null=True)
    priority = models.IntegerField(blank=True, null=True)
    alter_cause = models.TextField(blank=True, null=True)
    alter_front = models.TextField(blank=True, null=True)
    alter_later = models.TextField(blank=True, null=True)
    desc_file = models.TextField(blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    modify_time = models.DateTimeField(blank=True, null=True)
    upload_time = models.DateTimeField(blank=True, null=True)
    c_confirm = models.IntegerField(blank=True, null=True)
    customer_info = models.ForeignKey('TbCustomInfo', on_delete=models.DO_NOTHING, db_column='customer_info', blank=True, null=True)
    copy_id = models.IntegerField(blank=True, null=True)
    drawingtype = models.IntegerField(blank=True, null=True)
    modify_draft = models.IntegerField(blank=True, null=True)
    valid = models.IntegerField(blank=True, null=True)
    create_people = models.CharField(max_length=255, blank=True, null=True)
    current = models.IntegerField(blank=True, null=True)
    enabled = models.IntegerField(blank=True, null=True)
    file_version = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_customer_paper'




class TbDrawingFile(models.Model):
    file_version = models.CharField(max_length=255, blank=True, null=True)
    file_name = models.CharField(max_length=255, blank=True, null=True)
    file_size = models.IntegerField(blank=True, null=True)
    file_path = models.CharField(max_length=255, blank=True, null=True)
    uploader = models.CharField(max_length=255, blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    customer = models.ForeignKey('TbCustomerPaper', on_delete=models.DO_NOTHING, blank=True, null=True)
    file_type = models.IntegerField(blank=True, null=True)
    project = models.ForeignKey('TbProjectPaper', on_delete=models.DO_NOTHING, blank=True, null=True)
    drawing_type = models.ForeignKey('TbDrawing', on_delete=models.DO_NOTHING, blank=True, null=True)
    cus = models.IntegerField(blank=True, null=True)
    drawing_type_name = models.CharField(max_length=255, blank=True, null=True)
    dev_type = models.CharField(max_length=255, blank=True, null=True)
    id_dev_type = models.ForeignKey('TbTypeDevice', on_delete=models.DO_NOTHING, db_column='id_dev_type', blank=True, null=True)
    b_all = models.IntegerField(blank=True, null=True)
    sign_filepath = models.CharField(max_length=255, blank=True, null=True)
    seal_filepath = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_drawing_file'




class TbProjectPaper(models.Model):
    ecn_no = models.CharField(db_column='ECN_NO', max_length=255, blank=True, null=True)  # Field name made lowercase.
    version = models.CharField(max_length=255, blank=True, null=True)
    definer_name = models.CharField(max_length=255, blank=True, null=True)
    st_site = models.CharField(db_column='ST_site', max_length=255, blank=True, null=True)  # Field name made lowercase.
    project_name = models.CharField(max_length=255, blank=True, null=True)
    p_type = models.CharField(max_length=255, blank=True, null=True)
    custters_spec = models.CharField(max_length=255, blank=True, null=True)
    case_name = models.CharField(max_length=255, blank=True, null=True)
    priority = models.IntegerField(blank=True, null=True)
    secrecy_level = models.IntegerField(blank=True, null=True)
    id_stage_type = models.IntegerField(blank=True, null=True)
    stage_type = models.CharField(max_length=255, blank=True, null=True)
    case_no = models.CharField(db_column='case_NO', max_length=255, blank=True, null=True)  # Field name made lowercase.
    alter_cause = models.TextField(blank=True, null=True)
    alter_front = models.TextField(blank=True, null=True)
    alter_later = models.TextField(blank=True, null=True)
    desc_file = models.TextField(blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    modify_time = models.DateTimeField(blank=True, null=True)
    id_cutter_type = models.IntegerField(blank=True, null=True)
    cutter_type = models.CharField(max_length=255, blank=True, null=True)
    id_copy = models.IntegerField(blank=True, null=True)
    upload_time = models.DateTimeField(blank=True, null=True)
    uploader = models.CharField(max_length=255, blank=True, null=True)
    p_confirm = models.IntegerField(blank=True, null=True)
    drawing_type = models.CharField(max_length=255, blank=True, null=True)
    id_drawing_type = models.IntegerField(blank=True, null=True)
    dev_type = models.CharField(max_length=255, blank=True, null=True)
    id_dev_type = models.IntegerField(blank=True, null=True)
    valid = models.IntegerField(blank=True, null=True)
    create_people = models.CharField(max_length=255, blank=True, null=True)
    current = models.IntegerField(blank=True, null=True)
    enabled = models.IntegerField(blank=True, null=True)
    file_version = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_project_paper'

class TbPrintFile(models.Model):
    p_file = models.CharField(max_length=255, blank=True, null=True)
    p_reason = models.CharField(max_length=255, blank=True, null=True)
    p_num = models.IntegerField(blank=True, null=True)
    p_depar = models.CharField(max_length=255, blank=True, null=True)
    p_name = models.CharField(max_length=255, blank=True, null=True)
    p_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_print_file'


class TbDrawing(models.Model):
    drawing_type = models.CharField(max_length=50, blank=True, null=True)
    creator = models.CharField(max_length=30, blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    modify_time = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    cutter = models.ForeignKey('TbProdectStarge', on_delete=models.DO_NOTHING, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_drawing'

class TbProdectStarge(models.Model):
    product_stage = models.CharField(max_length=20, blank=True, null=True)
    type = models.ForeignKey('TbCutterType', on_delete=models.DO_NOTHING, blank=True, null=True)
    modify_time = models.DateTimeField(blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_prodect_starge'


class TbCutterType(models.Model):
    cutter_type = models.CharField(max_length=20, blank=True, null=True)
    modify_time = models.DateTimeField(blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_cutter_type'

class TbTypeDevice(models.Model):
    dev_type = models.CharField(max_length=255, blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    create_people = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_type_device'


class TbApplyform(models.Model):
    card_id = models.CharField(max_length=30, blank=True, null=True)
    form = models.ForeignKey('TbForms', blank=True, null=True)
    form_content = models.TextField(blank=True, null=True)
    apply_type = models.CharField(max_length=50, blank=True, null=True)
    applicant = models.CharField(max_length=50, blank=True, null=True)
    apply_dept = models.CharField(max_length=50, blank=True, null=True)
    apply_time = models.DateTimeField(blank=True, null=True)
    form_footer = models.CharField(max_length=255, blank=True, null=True)
    sign_status = models.IntegerField(blank=True, null=True)
    wrecord = models.ForeignKey('Workflowrecord',  blank=True, null=True)
    desc = models.CharField(max_length=255, blank=True, null=True)
    name = models.CharField(max_length=30, blank=True, null=True)
    apply_endtime = models.DateTimeField(blank=True, null=True)
    file1 = models.TextField(blank=True, null=True)
    file2 = models.CharField(max_length=255, blank=True, null=True)
    file3 = models.CharField(max_length=255, blank=True, null=True)
    file4 = models.CharField(max_length=255, blank=True, null=True)
    file5 = models.CharField(max_length=255, blank=True, null=True)
    file6 = models.CharField(max_length=255, blank=True, null=True)
    degree = models.CharField(max_length=20, blank=True, null=True)
    sign_image = models.CharField(max_length=20, blank=True, null=True)
    layout = models.CharField(max_length=25, blank=True, null=True)
    pdf = models.CharField(max_length=255, blank=True, null=True)
    customer = models.ForeignKey('TbCustomerPaper', blank=True, null=True)
    project = models.ForeignKey('TbProjectPaper', blank=True, null=True)
    is_form = models.CharField(max_length=20, blank=True, null=True)
    class Meta:
        managed = False
        db_table = 'tb_applyform'

class Workflowrecord(models.Model):
    applicant = models.CharField(max_length=45, blank=True, null=True)
    status = models.CharField(max_length=45, blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    workflow = models.ForeignKey('Workflowid', on_delete=models.DO_NOTHING)
    end_time = models.CharField(max_length=45, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'workflowrecord'


class Workflowid(models.Model):
    name = models.CharField(max_length=45, blank=True, null=True)
    description = models.CharField(max_length=45, blank=True, null=True)
    effective_time = models.DateTimeField(blank=True, null=True)
    end = models.IntegerField(blank=True, null=True)
    start = models.IntegerField(blank=True, null=True)
    pattern = models.TextField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'workflowID'

class TbForms(models.Model):
    table_name = models.CharField(max_length=100)
    table_content = models.TextField(blank=True, null=True)
    create_time = models.DateTimeField(blank=True, null=True)
    table_type = models.ForeignKey('TbFormtype', blank=True, null=True)
    creater = models.CharField(max_length=15, blank=True, null=True)
    version = models.CharField(max_length=10, blank=True, null=True)
    status = models.IntegerField(blank=True, null=True)
    desc = models.CharField(max_length=255, blank=True, null=True)
    workflow = models.ForeignKey('TbWorkflow',  blank=True, null=True)
    modify_time = models.DateTimeField(blank=True, null=True)
    sign_type = models.CharField(max_length=20, blank=True, null=True)
    layout = models.CharField(max_length=25, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_forms'

class TbFormtype(models.Model):
    forms_type = models.CharField(max_length=50, blank=True, null=True)
    type_english = models.CharField(max_length=100, blank=True, null=True)
    type_code = models.CharField(max_length=15, blank=True, null=True)
    type_id = models.IntegerField(blank=True, null=True)
    statue = models.IntegerField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_formtype'


class TbWorkflow(models.Model):
    name = models.CharField(max_length=20)
    description = models.CharField(max_length=150, blank=True, null=True)
    effective_time = models.IntegerField(blank=True, null=True)
    end = models.IntegerField(blank=True, null=True)
    start = models.IntegerField(blank=True, null=True)
    enabled = models.IntegerField(blank=True, null=True)
    founder = models.CharField(max_length=30, blank=True, null=True)
    rectime = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)
    username = models.CharField(max_length=45, blank=True, null=True)
    flowchart = models.TextField(blank=True, null=True)
    workflow_type = models.CharField(max_length=50, blank=True, null=True)
    update_type = models.CharField(max_length=10, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'tb_workflow'

